public class MethodParameter02 {
    public static void main(String[] args) {
        int[] arr = {1,2,3};
        BBB bbb = new BBB();
        bbb.test100(arr);
        System.out.println("main方法中修改之后:");
        for(int i = 0;i < arr.length; i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();

        Person2 p = new Person2();
        p.name = "小明";
        p.age = 18;
        bbb.test200(p);
        System.out.println("main方法中p.age="+p.age);
    }
}
//引用数据类型的传参机制
class Person2{
    String name;
    int age;
}
class BBB{
    public void test200(Person2 p){
        //p.age = 20;//改了
        //思考
        //p = null;
        //思考
        Person2 p2 = new Person2();
        p2.age = 20;
    }
    public void test100(int arr[]){
        arr[0] =100;
        System.out.println("修改之后:");
        for(int i = 0;i < arr.length; i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
    }
}
